package control;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import survey.Synchronizer;

import gui.CameraPanel;
/**
 * ForcedSync is used to register for gui events that puts the
 * client in sync mode or async mode
 *
 */
public class ForcedSync {
	private ConnectionManager connect;
	private CameraPanel view;

	public ForcedSync(ConnectionManager connect, CameraPanel cameraPanel) {
		this.connect = connect;
		this.view = cameraPanel;
		cameraPanel.addAsyncListener(new AsyncListener());
		cameraPanel.addSyncListener(new SyncListener());	

	}

	public class AsyncListener implements ActionListener {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			connect.getSurveyController().setAsync();

		}
	}

	public class SyncListener implements ActionListener {
		@Override
		public void actionPerformed(ActionEvent arg0) {
			connect.getSurveyController().setSync();

		}

	}
	
	
}
